<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/06/10
// +----------------------------------------------------------------------

namespace app\erp\model;

use think\Model;

/**
 * 调拨管理-详细表
 * @package app\erp\model
 */
class ErpAllocationSku extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'xm_erp_goods_allocation_sku';

    /**
     * 添加数据
     * @param allocation_id 	int     调拨订单
     * @param sku_id 		    int     单品id
     * @param num 		        int     单品数量
     * @param create_time 		date
     * @param update_time 	    date
     * @author dou<51779987@qq.com>
     * @return array_out(code, message, (int)id)
     */
    public function addData($allocation_id, $sku_id, $num){
        $data['allocation_id'] = $allocation_id;
        $data['sku_id']        = $sku_id;
        $data['num']           = $num;
        $res = $this -> isUpdate(false) ->data($data, true) -> save();
        if($res){
            return array_out(200, 'success');
        }else{
            return array_out(-1001, 'error');
        }
    }
}
